import com.cn.Mapper.enployeeMapper.EmployeeMapper;
import com.cn.entity.enployee.Employee;
import com.cn.util.SqlsesstionUtil;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;


import java.util.List;

/**
 * @ClassName testEmployee
 * @Description TODO
 * @Author yujiajing
 * @Date 2022/10/12 9:34
 * @Version 1.0
 */
public class testEmployee {
/*    @Autowired
    EmployeeMapper employeeMapper;*/
    @Test
    public  void showEmployee(){
        SqlSession sqlSession= SqlsesstionUtil.getSqlSession();
        EmployeeMapper enployeeMapper=sqlSession.getMapper(EmployeeMapper.class);
        List<Employee> employeeList=enployeeMapper.showEmployee();
        System.out.println(employeeList.toString());
    }
    @Test
    public void deletEmployee(){
        SqlSession sqlSession= SqlsesstionUtil.getSqlSession();
        EmployeeMapper employeeMapper=sqlSession.getMapper(EmployeeMapper.class);

        employeeMapper.deleteEmployee("1");
        System.out.println("解雇成功!");
    }
    @Test
    public  void addEmployee() {
        SqlSession sqlSession = SqlsesstionUtil.getSqlSession();
        EmployeeMapper enployeeMapper = sqlSession.getMapper(EmployeeMapper.class);
        Employee employee = new Employee("2", "阿七", "翠园店", "运营部");
        enployeeMapper.addEmployee(employee);
    }
    @Test
    public void updateEmployeeForShop(){
            SqlSession sqlSession= SqlsesstionUtil.getSqlSession();
            EmployeeMapper enployeeMapper=sqlSession.getMapper(EmployeeMapper.class);
            enployeeMapper.updateEmployeeForShop("北港","1");
        }
        @Test
    public void updateEmployeeForDpepart(){
        SqlSession sqlSession= SqlsesstionUtil.getSqlSession();
        EmployeeMapper enployeeMapper=sqlSession.getMapper(EmployeeMapper.class);
        enployeeMapper.updateEmployeeForDepart("前台","1");
    }
    }
